package show;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;

import util.JdbcUtil;

@SuppressWarnings("unchecked")
public class Main_show 
{
	private Connection conn;
	private PreparedStatement ps;
	private ResultSet rs;
	
	private LinkedList NAME;
	private LinkedList<Integer> ID;
	private LinkedList PSW;
	private LinkedList QQ;
	private LinkedList LOCAL;
	private LinkedList SEX;
	private LinkedList MAIL;
	private LinkedList BIRTH;
	private LinkedList TEL;
	
	public Main_show()
	{
		conn = JdbcUtil.getConnection();
		
		NAME = new LinkedList();
		ID = new LinkedList<Integer>();
		PSW = new LinkedList();
		QQ = new LinkedList();
		LOCAL = new LinkedList();
		SEX = new LinkedList();
		BIRTH = new LinkedList();
		TEL = new LinkedList();
		MAIL = new LinkedList();
		
		
		
		String table = "main_info";
		String sql = "select * from "+table;
		try
		{
			ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			while(rs.next())
			{
				ID.add(rs.getInt("SchID"));
				NAME.add(rs.getString("NAME"));
				PSW.add(rs.getString("PSW"));
				QQ.add(rs.getString("QQ"));
				TEL.add(rs.getString("TEL"));
				MAIL.add(rs.getString("MAIL"));
				LOCAL.add(rs.getString("LOCAL"));
				BIRTH.add(rs.getString("BIRTH"));
				SEX.add(rs.getString("SEX"));
			}
		}
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		finally
		{
			JdbcUtil.release(conn, ps, rs);
		}
	}
	public LinkedList getNAME() {
		return NAME;
	}
	public LinkedList<Integer> getID() {
		return ID;
	}
	public LinkedList getPSW() {
		return PSW;
	}
	public LinkedList getQQ() {
		return QQ;
	}
	public LinkedList getLOCAL() {
		return LOCAL;
	}
	public LinkedList getSEX() {
		return SEX;
	}
	public LinkedList getMAIL() {
		return MAIL;
	}
	public LinkedList getBIRTH() {
		return BIRTH;
	}
	public LinkedList getTEL() {
		return TEL;
	}
//	public static void main(String[] args)
//	{
//		Main_show s = new Main_show();
//		for(int i = 0;i<s.getNAME().size();i++)
//		{
//			System.out.println(s.getID().get(i));
//		}
//		String a = "jj";
//		if(a.matches("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"))
//		{
//			System.out.print("yes");
//		}
//	}
}